package com.huage_04.lesson_02;

public class AnimalDemo {
    public static void main(String[] args) {
        //多态 向上转型
        Animal a = new Cat();

        //访问成员变量
        System.out.println(a.age);
        //a.weight;

        //访问成员方法
        a.eat();
        //a.playGame();

        //多态 向下转型
        Cat c = (Cat)a;
        c.playGame();
        System.out.println(c.weight);

    }
}
